package morning.cat;

import feign.Feign;
import feign.gson.GsonDecoder;
import feign.gson.GsonEncoder;
import feign.httpclient.ApacheHttpClient;
import feign.okhttp.OkHttpClient;
import morning.cat.client.PersonClient;
import morning.cat.entity.Person;
import morning.cat.feign.MyFeignClient;
import morning.cat.service.UrlService;

/**
 * @describe: 类描述信息
 * @author: morningcat.zhang
 * @date: 2019/6/4 2:00 PM
 */
public class PersonTest3 {

    public static void main(String[] args) {
        // 获取服务接口
        PersonClient personClient = Feign.builder()
                .decoder(new GsonDecoder())
                .client(new MyFeignClient())
                //.client(new OkHttpClient())
                .client(new ApacheHttpClient())
                .target(PersonClient.class, UrlService.SERVER_URL);

        // 请求Hello World接口
        Person result = personClient.findById(1);
        System.out.println("    接口响应内容：" + result);
    }
}
